/**
 * Copyright (c) 2006-2013 Las Venturas Mineground
 *
 * This program is free software: you can redistribute it and/or modify it under the terms of the
 * GNU General Public License as published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 */

package org.mineground.events;

/**
 * Event listeners will be invoked based on their priority. When a listener does not specify a
 * priority, we'll assume NORMAL. The Event Dispatcher will keep track of this, and keep a sorted
 * list of the listeners based on their priority. Listeners with a lower priority are not guaranteed
 * to be invoked, as higher priority events can cancel the invocation chain.
 */
public enum EventPriority {
    HIGHEST(0),
    HIGH(1),
    NORMAL(2),
    LOW(3),
    LOWEST(4);
    
    /**
     * The numeric value of the event priority. Initialized by the constructor.
     */
    private int mNumericPriority;
    
    /**
     * Initializes this Event Priority value with the numeric priority as specified earlier on in
     * this class. Declared private, as only values of this enum are valid priorities.
     * 
     * @param numericPriority Numeric value of the priority that's being created.
     */
    private EventPriority(int numericPriority) {
        mNumericPriority = numericPriority;
    }
    
    /**
     * Returns the numeric value of the priority, which enables sorting of event listeners.
     * 
     * @return Numeric value of the event priority.
     */
    public int numericPriority() {
        return mNumericPriority;
    }
}